<template>
  <el-dialog v-model="visible" :title="'译码文件'" :close-on-click-modal="false" :close-on-press-escape="false">
    <el-table v-loading="state.dataListLoading" :data="state.dataList" border @selection-change="state.dataListSelectionChangeHandle" style="width: 100%" max-height="350">
      <el-table-column prop="aAILL" label="aAILL" header-align="center" align="center"></el-table-column>
      <el-table-column prop="rownum" label="rownum" header-align="center" align="center"></el-table-column>
      <el-table-column prop="28HBB" width="188" label="28HBB" header-align="center" align="center"></el-table-column>
      <el-table-column prop="28SBS2" width="188" label="28SBS2" header-align="center" align="center"></el-table-column>
      <el-table-column prop="28VB1S2" width="188" label="28VB1S2" header-align="center" align="center"></el-table-column>
      <!-- 暂未使用 -->
      <el-table-column v-if="state.hasPermission('sys:rawdatainfo:update') || state.hasPermission('sys:rawdatainfo:delete')" 
        :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
        <template v-slot="scope">
          <el-button v-if="state.hasPermission('sys:rawdatainfo:update')" type="primary" link>{{ $t("update") }}</el-button>
          <el-button v-if="state.hasPermission('sys:rawdatainfo:delete')" type="primary" link @click="state.deleteHandle(scope.row.filename)">{{ $t("delete") }}</el-button>
        </template>
      </el-table-column>  
    </el-table>
    <template v-slot:footer>
      <el-button @click="visible = false">{{ $t("cancel") }}</el-button>
      <el-button type="primary" @click="dataFormSubmitHandle()">{{ $t("confirm") }}</el-button>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>
import qs from "qs";

import baseService from "@/service/baseService";
import { useI18n } from "vue-i18n";
import { ElMessage } from "element-plus";

export interface IParams {
  filename: string;
  qarType: string;
  columns: string;
}
import { reactive, ref, toRefs } from "vue";
import useView from "@/hooks/useView";
const { t } = useI18n();
const emit = defineEmits(["refreshDataList"]);

const visible = ref(false);

const view = reactive({

});
const state = reactive({ ...useView(view), ...toRefs(view) });

const init = (params: IParams) => {
  visible.value = true;
  // dataForm.filename = "";

  // 重置表单数据
  // if (dataFormRef.value) {
  //   dataFormRef.value.resetFields();
  // }

  if (params) {
    getInfo(params);
  }
};

// 获取信息
const getInfo = (params:any) => {
  baseService.get("/sys/rawdatainfo/list?"+qs.stringify(params)).then((res) => {
    state.dataList = res.data.dataList;
  })
};

// 表单提交
const dataFormSubmitHandle = () => {
};

defineExpose({
  init
});
</script>